package com.uniqueyi.modulemain;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
import com.alibaba.android.arouter.launcher.ARouter;
import com.uniqueyi.baselib.utilsbase.log.LogUtil;

@Route(path ="main/main")
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.aty_main);

        findViewById(R.id.bt).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance().build("/book/main").navigation(MainActivity.this, new NavigationCallback() {
                    @Override
                    public void onFound(Postcard postcard) {
                        LogUtil.getLogUtil().log("xxx","onFound");
                    }

                    @Override
                    public void onLost(Postcard postcard) {
                        LogUtil.getLogUtil().log("xxx","onLost");
                    }

                    @Override
                    public void onArrival(Postcard postcard) {
                        LogUtil.getLogUtil().log("xxx","onArrival");
                    }

                    @Override
                    public void onInterrupt(Postcard postcard) {
                        LogUtil.getLogUtil().log("xxx","onInterrupt");
                    }
                });
            }
        });

        findViewById(R.id.bt2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance().build("/main/test").navigation();
            }
        });
    }
}
